import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import VueParticles from 'vue-particles'
/*markdown插件导入*/
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'

Vue.use(ElementUI);
Vue.config.productionTip = false
import axios from 'axios'
Vue.prototype.axios = axios
// 引入粒子特效

Vue.use(VueParticles)

// use
Vue.use(mavonEditor)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')


// 添加请求拦截器，在请求头中加token
Vue.prototype.axios = axios;
axios.interceptors.request.use(
    config => {
      if (localStorage.getItem("jwt")) {
        config.headers.Authorization = localStorage.getItem("jwt");
      }
      return config;
    },
    error => {
      return Promise.reject(error);
    }
);